<template>
  <div class="box">
    <div class="top">
      <span class="name">小区名称</span>
      <span>维修</span>
      <span>卫生</span>
      <span>养护</span>
      <span>装修</span>
      <span>安全</span>
      <span>秩序</span>
      <span>纠纷</span>
      <span>其他</span>
      <span>合计</span>
      <span>已解决</span>
      <span>完成率</span>
    </div>
    <div class="scroll-list" :style="{ height: 2.2 * $store.state.radomRate + 'rem' }" @click.stop="clickProps($event)">
      <vue-seamless-scroll :data="listData" :class-option="classOption">
        <ul class="item">
          <li v-for="(item,index) in listData" :key="index">
            <span class="name">{{item.communityName}}</span>
            <span>{{item.repairCount}}件</span>
            <span>{{item.hygieneCount}}件</span>
            <span>{{item.maintainCount}}件</span>
            <span>{{item.fitmentCount}}件</span>
            <span>{{item.safeCount}}件</span>
            <span>{{item.sequenceCount}}件</span>
            <span>{{item.disputeCount}}件</span>
            <span>{{item.otherCount}}件</span>
            <span>{{item.totalCount}}件</span>
            <span>{{item.dealCount}}件</span>
            <span>{{item.dealPercent}}%</span>
          </li>
        </ul>
      </vue-seamless-scroll>
    </div>
  </div>
</template>
<script>
import vueSeamlessScroll from "vue-seamless-scroll";
export default {
  components: {
    vueSeamlessScroll,
  },
  data() {
    return {
      listData: [],
      time: new Date().getTime(),
    };
  },
  mounted(){
    this.communityTypeRank();
  },
  computed: {
    classOption() {
      return {
        step: 0.2, // 数值越大速度滚动越快
        limitMoveNum: 5, // 开始无缝滚动的数据量 this.dataList.length
        hoverStop: true, // 是否开启鼠标悬停stop
        direction: 1, // 0向下 1向上 2向左 3向右
        openWatch: true, // 开启数据实时监控刷新dom
        singleHeight: 0, // 单步运动停止的高度(默认值0是无缝不停止的滚动) direction => 0/1
        singleWidth: 0, // 单步运动停止的宽度(默认值0是无缝不停止的滚动) direction => 2/3
        waitTime: 1000, // 单步运动停止的时间(默认值1000ms)
      };
    },
  },
  methods:{
    communityTypeRank(){
      let params = {
        time:this.time
      }
      let result = this.$md5.transferValue(params);
      this.axios.post(this.stateUrl.dataModel.communityTypeRank,{
        time:this.time,
        sign: this.$md5.val(result)
      }).then(res=>{
        this.listData = res.data.data;
      }).catch(()=>{})
    },
    clickProps(e){
      this.$router.push("/adviceList");
    }
  }
};
</script>
<style lang="less" scoped>
.box {
  color: #fff;
  font-size: 0.12rem;
  height: 100%;
  padding: 0.2rem 0 0;
  .top {
    display: flex;
    margin:0 0.1rem;
    background: rgba(50, 146, 255, 0.2);
    height:0.35rem;
    line-height: 0.35rem;
  }
  .scroll-list {
      overflow: hidden;
    .item {
      li {
        display: flex;
        margin:0 0.1rem;
        height:0.35rem;
        line-height: 0.35rem;
        cursor: pointer;
        &:nth-child(2n){
            background: rgba(50, 146, 255, 0.2);
        }
         &:nth-child(2n+1){
            background: none;
        }
      }
    }
  }
  span {
    width:8%;
    display: inline-block;
    text-align: center;
    &.name{
        width:14%;
    }
  }
}
</style>